class Solution {
public:
    int peakIndexInMountainArray(vector<int>& arr)
    {
        int left = 1, right = arr.size() - 2;
        while (left < right)
        {
            int mid = left + (right - left + 1) / 2;
            if (arr[mid - 1] < arr[mid])
                left = mid;
            else if (arr[mid - 1] > arr[mid])
                right = mid - 1;


        }

        return left;

    }
};